import ReactDOM from 'react-dom'
import { Component, ReactNode } from 'react'

type State = {
  count: number
}
class Counter extends Component<{}, State> {
  state: State = {
    count: 0
  }

  onClick = () => {
    this.setState({
      count: this.state.count + 1
    })
  }

  render (): ReactNode {
    return (
      <div>
        <h1>{this.state.count}</h1>
        <button onClick={this.onClick}>加1</button>
      </div>
    )
  }
}

ReactDOM.render(<Counter />, document.getElementById('root'))
